#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("127.0.0.1", 2000))

while True:
    msg, addr = sock.recvfrom(1024)
    print(msg, addr)
    sock.sendto("服务端收到数据 {}".format(msg).encode("utf-8"), addr)

